import { Navigate } from "react-router-dom";
import { GetUserToken } from "../utils";
import { ReactElement } from "react";
import { LOGIN_PATHNAME } from "../concats";
import { message } from "antd";

const AuthRouter = (props:{children:ReactElement}) =>{
    const token = GetUserToken()
    const {children} = props
    if(!token){
        message.error('未登录')
        return <Navigate to={LOGIN_PATHNAME}></Navigate>
    }
    return children
}

export default AuthRouter